New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@stellar/stellar-base

Package Overview
Dependencies
Maintainers
8
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stellar/stellar-base

Low-level support library for the Stellar network.

  • 12.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
8
Created

What is @stellar/stellar-base?

@stellar/stellar-base is a JavaScript library for building applications on the Stellar network. It provides core functionalities for creating, signing, and submitting transactions, as well as working with Stellar's data structures and protocols.

What are @stellar/stellar-base's main functionalities?

Transaction Creation

This code demonstrates how to create a payment transaction on the Stellar network using the @stellar/stellar-base package. It sets up a transaction builder with a source account, adds a payment operation, and builds the transaction.

const StellarSdk = require('stellar-base');
const source = new StellarSdk.Account('GCFX...YOUR_ACCOUNT_ID', '1');
const transaction = new StellarSdk.TransactionBuilder(source, {
  fee: StellarSdk.BASE_FEE,
  networkPassphrase: StellarSdk.Networks.TESTNET
})
  .addOperation(StellarSdk.Operation.payment({
    destination: 'GCFX...DESTINATION_ACCOUNT_ID',
    asset: StellarSdk.Asset.native(),
    amount: '10'
  }))
  .setTimeout(30)
  .build();

Transaction Signing

This code shows how to sign a transaction using a secret key with the @stellar/stellar-base package. The transaction is signed with the keypair derived from the secret.

const StellarSdk = require('stellar-base');
const transaction = // assume this is a built transaction
const keypair = StellarSdk.Keypair.fromSecret('S...YOUR_SECRET');
transaction.sign(keypair);

Keypair Generation

This code demonstrates how to generate a new random keypair using the @stellar/stellar-base package. It outputs the public and secret keys.

const StellarSdk = require('stellar-base');
const pair = StellarSdk.Keypair.random();
console.log(pair.publicKey());
console.log(pair.secret());

Other packages similar to @stellar/stellar-base

Keywords

FAQs

Package last updated on 12 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc